import {BrowserRouter, useRoutes} from "react-router-dom"
import {Suspense, lazy} from "react"

// 主路由
const App = lazy(() => import("../views/app/App"))
const Task = lazy(() => import("../views/task/Task"))

const Path = () => {
    return useRoutes([
        {path: "/", element: <App/>},
        {path: "/task", element: <Task/>},
    ])
}

const MainRouter = () => {
    return (
        <BrowserRouter>
            <Suspense fallback={"加载中..."}>
                <Path/>
            </Suspense>
        </BrowserRouter>
    )
}

export default MainRouter